package com.njit.farm.controller;

import com.njit.farm.model.Land;
import com.njit.farm.model.Result;
import com.njit.farm.service.LandService;
import javafx.geometry.Pos;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/land/")
public class LandController {

    @Resource
    LandService landService;

    @RequestMapping(value = "add",method = RequestMethod.POST)
    public Result add(@RequestBody Land land){
        return landService.add(land);
    }

    @RequestMapping(value = "update", method = RequestMethod.POST)
    public Result update(@RequestBody Land land) {
        return landService.update(land);
    }

    @RequestMapping(value = "getByUid", method = RequestMethod.GET)
    public Result getByUserId(@RequestParam("uId") String uId) {
        return landService.getByUserId(uId);
    }
}
